﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using V5_Common;
using V5_BLL;

namespace V5_EShop.Ajax
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class ajax_user : IHttpHandler
    {
        HttpContext _context = null;
        public void ProcessRequest(HttpContext context)
        {
            _context = context;
            string action = Input.SetString(_context.Request["action"]);
            switch (action.ToLower().Trim())
            {
                case "chkuserreg":

                    check_user_reg();
                    break;
            }
            _context.Response.End();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// 检查用户是否能注册
        /// </summary>
        /// <returns></returns>
        public void check_user_reg()
        {
            string username = Input.SetString(_context.Request["txtUserName"]);
            BLLUser blluser = new BLLUser();
            if (blluser.CheckRegUser(username))
            {
                _context.Response.Write("1");
            }
            else
            {
                _context.Response.Write("0");
            }
        }
    }
}
